package com.example.android

import android.app.Service
import android.content.Intent
import android.os.IBinder

/**
 * @ClassName MyServices
 * @Author Ryan Kamanri
 * @Date 2022/6/2
 * @Description 全局绑定服务, 包含服务类对象, 需要注意在Manifest注册
 **/
class MyServices: Service() {

    private lateinit var _ServicesObject: ServicesObject

    override fun onCreate() {
        super.onCreate()
        _ServicesObject = ServicesObject(applicationContext)
    }

    override fun onBind(intent: Intent?): IBinder {
        return _ServicesObject
    }

    override fun onDestroy() {
        super.onDestroy()
        _ServicesObject.dispose()
    }
}